<?php
/**
 * Front page tabs markup helper.
 *
 * @category Zend
 * @package Helper
 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc.
 * @version $Id$
 * @link http://framework.zend.com
 * @since Available since release 1.0
 * @license GPL v3
 */

class Zend_View_Helper_FrontPageTabsHelper extends Zend_View_Helper_Abstract
{
    /**
     * Zend_View_Interface
     */
    protected $_view;
    
    /**
     * Automatically sets view property when loaded
     * 
     * @param Zend_View_Interface $view 
     */
    public function setView(Zend_View_Interface $view)
    {
        $this->_view = $view;
    }
    
    /**
     * Returns front page tabs HTML
     * 
     * @return string
     */
    public function frontPageTabsHelper()
    {
        $category = $this->_view->category ? $this->_view->category : 'all';
        $postTab = '/user/login/post/' . strtolower($category);
        if ($this->_view->session->username) {
            $postTab = '#post';
        }
        
        $active = '#top';
        if ($this->_view->active) {
            $active = '#' . $this->_view->active;
        }
        
        $tabs = array(
            '#top' => 'Top',
            '#new' => 'New',
            '#open' => 'Open',
            $postTab => 'Post to Disputeo &rarr;'
        );
        
        return $this->_view->partial('partials/tabs.phtml', array(
            'tabs' => $tabs,
            'active' => $active,
            'category' => $category
        ));
    }
}
